<?php
require_once 'Zend/Validate/Abstract.php';
class Validate_Category extends Zend_Validate_Abstract
{
    const CATEGORY = 'category';
    protected $_messageTemplates = array(
        self::CATEGORY => "'%value%' is not a valid category ID"
    );

    public function isValid($value)
    {
        $this->_setValue($value);

        $Categories = new Categories();
        $row = $Categories->fetchRow($Categories->select()->where('cid = ?', $value));

        return ($row) ? true : false ;
    }
}


